#ifndef _ZWMK_H_
#define _ZWMK_H_

#include "main.h"
#include "string.h"
#include "stdio.h"

#define BufSize 125
#define ZWMK_Wake_Pin GPIO_PIN_8
#define ZWMK_Wake_Port GPIOA
#define ZWMK_Wake_ON  __HAL_RCC_GPIOA_CLK_ENABLE()
#define ZWMK_Wake_OFF __HAL_RCC_GPIOA_CLK_DISABLE()

//#define AS608Addr 0xFFFFFFFF
//#define HeadHex   0xEF01
//#define CmdHex    0x01
//#define DataHex   0x02

extern uint8_t ZWMK_Buf[BufSize];
extern UART_HandleTypeDef UART1_Handler;
extern UART_HandleTypeDef UART2_Handler;
extern uint8_t f;
extern uint8_t RxCounter;
extern uint8_t Addr_Head[7];
extern uint8_t GetImage[];
extern uint8_t Search[];
extern uint8_t Temp[BufSize];
extern uint8_t GetImageAck[];
extern uint8_t GenChar[];
extern uint8_t GenCharAck[];
extern uint8_t flag;
extern uint8_t SearchAck[];
extern uint8_t Identify[];
extern uint8_t IdentifyAck[];
extern uint8_t Match[];
extern uint8_t MatchAck[];

void UART_Init();

void ZWMK_GPIO_Init();

void ZWMK_Init();

void ZWMK_SData();

uint8_t ZWMK_SCmd(uint8_t* cmd,uint8_t* ack,uint16_t time);

uint8_t DataLen(uint8_t* data);


uint8_t ZWMK_Check(uint8_t* ack,const uint8_t* temp);


#endif